{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "264ff6df-4578-4200-b527-6cf92c8957e6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "    名称     单价   数量\n",
      "0  小太阳  320.9  100\n",
      "1   鼠标  128.0   50\n",
      "2   小刀    1.5  200\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "## 列表方式创建DataFrame对像\n",
    "data=[['小太阳', 320.9, 100], ['鼠标', 128, 50], ['小刀', 1.5, 200]]\n",
    "columns=['名称', '单价', '数量']\n",
    "df=pd.DataFrame(data=data, columns=columns)\n",
    "print(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "000b8865-4a63-4178-a130-8c8aaafafdc4",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "               单价          数量\n",
      "count    3.000000    3.000000\n",
      "mean   150.133333  116.666667\n",
      "std    160.846210   76.376262\n",
      "min      1.500000   50.000000\n",
      "25%     64.750000   75.000000\n",
      "50%    128.000000  100.000000\n",
      "75%    224.450000  150.000000\n",
      "max    320.900000  200.000000\n"
     ]
    }
   ],
   "source": [
    "print(df.describe())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "7d6ef8f5-272f-45f3-a8d1-a2e0361cfd84",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "名称    3\n",
      "单价    3\n",
      "数量    3\n",
      "dtype: int64\n"
     ]
    }
   ],
   "source": [
    "print(df.count())  # 非空值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "ba284f86-06bd-4e03-ab40-eebe7acd959a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "名称    小太阳鼠标小刀\n",
      "单价      450.4\n",
      "数量        350\n",
      "dtype: object\n"
     ]
    }
   ],
   "source": [
    "print(df.sum())  # 求和"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "dce48a61-65c8-4c51-9941-f1c60e49f6e3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "名称       鼠标\n",
      "单价    320.9\n",
      "数量      200\n",
      "dtype: object\n"
     ]
    }
   ],
   "source": [
    "print(df.max())  # 获得列的最大值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "88dd661e-0b97-4dc8-8ddb-4c7f93faaf17",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "名称     小刀\n",
      "单价    1.5\n",
      "数量     50\n",
      "dtype: object\n"
     ]
    }
   ],
   "source": [
    "print(df.min())"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
